package com.pjs.tdd;

import static org.junit.Assert.assertEquals;

import java.util.HashSet;

import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;

import com.pjs.test.framework.AbstractUnitTestCase;

public class TransactionCollectionImplTest extends AbstractUnitTestCase<TransactionCollectionImpl> {

	private @Mock Transaction transaction; 

	public TransactionCollectionImplTest() {
		super(TransactionCollectionImpl.class);
		
	}
	
	@Before
	public void setup(){
		classUnderTest.setTransactions(new HashSet<Transaction>());
	}
	
	@Test
	public void transactionCollectionAdd(){
		classUnderTest.add(transaction);
		assertTransactionCollectionSize(1);
	}
	
	@Test
	public void transactionCollectionRemove(){
		classUnderTest.add(transaction);
		classUnderTest.remove(transaction);
		assertTransactionCollectionSize(0);
	}
	
	private void assertTransactionCollectionSize(int sizeToCheck){
		assertEquals("number of transactions in collection is incorrect",sizeToCheck,classUnderTest.size());
		
	}
	
}
